﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
using System.Configuration;

public partial class IntervieweeForm : System.Web.UI.Page
{
    string RadioGender;
    string RadioCStatus;
    string RadioExperience;
    string WorkExperience;
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void ButtonSubmitInterviewForm_Click(object sender, EventArgs e)
    {
        string CS = ConfigurationManager.ConnectionStrings["DBCS"].ConnectionString;
        using (SqlConnection con = new SqlConnection(CS))
        {
            SqlCommand cmd = new SqlCommand("spAddInterviewee", con);
            cmd.CommandType = System.Data.CommandType.StoredProcedure;


            

            if (RadioButtonMale.Checked)
            {
                RadioGender = "Male";

            }
            else if (RadioButtonFemale.Checked)
            {
                RadioGender = "Female";

            }

            if (RadioButtonSingle.Checked)
            {
                RadioCStatus = "Single";

            }
            else if (RadioButtonMarried.Checked)
            {
                RadioCStatus = "Married";

            }

            if (RadioButtonExperienceNo.Checked)
            {
                RadioExperience = "No";

            }
            else if (RadioButtonExperienceYes.Checked)
            {
                RadioExperience = "Yes";

            }

            WorkExperience = RadioExperience + " , " + DropDownListExperienceYes.SelectedValue;


            cmd.Parameters.AddWithValue("@FName", TextBoxFName.Text);
            cmd.Parameters.AddWithValue("@MName", TextBoxMName.Text);
            cmd.Parameters.AddWithValue("@LName", TextBoxLName.Text);
            cmd.Parameters.AddWithValue("@Gender", RadioGender);
            cmd.Parameters.AddWithValue("@CStatus", RadioCStatus);
            cmd.Parameters.AddWithValue("@RAddress", TextBoxAddress.Text);
            cmd.Parameters.AddWithValue("@Contactno", TextBoxContactNo.Text);
            cmd.Parameters.AddWithValue("@Gpa", TextBoxGPA.Text);
            cmd.Parameters.AddWithValue("@Class", DropDownListClass.SelectedValue);
            cmd.Parameters.AddWithValue("@Alstream", DropDownListALStream.SelectedValue);
            cmd.Parameters.AddWithValue("@WorkExperience", WorkExperience);

            con.Open();
            cmd.ExecuteNonQuery();

            LabelInterviewFormRegStatus.Text = "Registration Successful!";
            con.Close();

        }
    }
}